package qustion4;

import java.util.HashSet;
import java.util.Set;

public class Lottery {

    private static Set<Integer> lotteryRed = new HashSet<Integer>();

    public static void produceRandomNo() {
        Integer randomNoInitial = (int) ((Math.random() * 32) + 1);
        lotteryRed.add(randomNoInitial);
        while(lotteryRed.size() != 6) {
            Integer randomNo = (int) ((Math.random() * 32) + 1);

            for (Integer integer : lotteryRed) {
                if (!lotteryRed.contains(randomNo)) {
                    lotteryRed.add(randomNo);
                    break;
                }
            }

        }
        System.out.println("6个红色球号码");
        for (Integer integer : lotteryRed) {
            System.out.println(integer.intValue());
        }
    }

    public static void main(String[] args) {
        int blueNo = (int)((Math.random() * 16) + 1);
        System.out.println("蓝色球号码是:"+blueNo);
        produceRandomNo();
    }
}
